package ipt.capitulo17;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class PrimerEventoVentana{
	JTextArea areaTexto;
	PrimerEventoVentana(){
		JFrame.setDefaultLookAndFeelDecorated(true);
		JFrame marco = new JFrame("Eventos de ventana");
		marco.addWindowListener(new GestionaVentana());
		areaTexto= new JTextArea();
		marco.add(areaTexto);
		marco.setSize(200,100);
		marco.setVisible(true);
	}
	public static void main(String args[]){
		PrimerEventoVentana e1=new PrimerEventoVentana();
	}
	class GestionaVentana extends WindowAdapter{
		public void windowClosing(WindowEvent e) {
			areaTexto.append("Cerrando la ventana\n");
			System.exit(0);
		}
		public void windowActivated(WindowEvent e){
			areaTexto.append("Activada la ventana\n");
		}
		public void windowOpened(WindowEvent e){
			areaTexto.append("Abierta la ventana\n");
		}
		public void windowIconified(WindowEvent e){
			areaTexto.append("Minimizada la ventana\n"); 
		}
		public void windowDeiconified(WindowEvent e){
			areaTexto.append("Desplegando la ventana\n");
		}
		public void windowDeactivated(WindowEvent e){
			areaTexto.append("Desactivada la ventana\n");
		}
	}
}
